//
//  AsyncFunc.h
//  JFTwxsd
//
//  Created by Steven on 2018/9/17.
//  Copyright © 2018年 junfeiweiyejiaoyujituan. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef void(^Finish)(id, NSError *);
typedef void(^AsyncFunc)(id, Finish);

AsyncFunc concat(AsyncFunc left, AsyncFunc right){
    
    return ^(id info, Finish com){
        left(info, ^(id result, NSError *error){
            
            if (error == nil) {
                com(nil, error);
                return;
            }
            
            right(info, ^(id result, NSError *error){
                com(result, error);

            });
        });

    };

}

@interface NSArray<AsyncFunc> (Async)

- (AsyncFunc)reduce;

@end










